using System;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public enum EPopType {
    PAUSE,
    RESULT
}
public class Pop : MonoBehaviour
{
    [SerializeField]private Image winImage;
    [SerializeField]private Image loseImage;
    [SerializeField]private Button nextBtn;

    [SerializeField]private Animation anim;

    private void OnEnable() {
        
    }

    void Start() {
        
    }

    private void OnDisable() {

    }

    /// <summary>
    /// 展示弹窗
    /// </summary>
    /// <param name="popType"></param>
    /// <param name="isWin"></param>
    public void Show(EPopType popType,bool isWin = false) {
        switch(popType) {
            case EPopType.PAUSE:
                winImage.gameObject.SetActive(false);
                loseImage.gameObject.SetActive(false);
                nextBtn.gameObject.SetActive(false);
            break;
            case EPopType.RESULT:
                winImage.gameObject.SetActive(isWin);
                loseImage.gameObject.SetActive(!isWin);
                nextBtn.gameObject.SetActive(isWin);
            break;
        }

        anim.Play();
    }

    public void BtnEvents(string type) {
        GameManager.Instance().audioManager.PlayAudio(EAudioType.CLICK);
        switch(type) {
            case "close":

            break;
            case "next":
                GameManager.Instance().levelManager.CurLevel++;
                GameManager.Instance().game.RestartGame();
            break;
            case "restart":
                GameManager.Instance().game.RestartGame();
            break;
            case "exit":

            break;
        }
        gameObject.SetActive(false);

    }
}
